//////////////////////////////////////////////////////////////////////////
//
// This file is a part of UKROP project.
// Copyright (c) Vladimir Gumenuk
//
// PROJECT:         Xort Custom Debug Engine
// FILE:            Context.h
// AUTHOR:          Vladimir Gumenuk
// DATE:            Dec-2012 -- Jan-2013
// MODIFICATIONS:
//
//////////////////////////////////////////////////////////////////////////

#pragma once
#include "resource.h"       // main symbols
#include "XortDebugEngine_i.h"

//////////////////////////////////////////////////////////////////////////
// CDocumentPosition
class ATL_NO_VTABLE CDocumentPosition : 
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CDocumentPosition, &CLSID_DocumentPosition>,
    public IDebugDocumentPosition2 
{
public:
    CDocumentPosition();
    virtual ~CDocumentPosition();

DECLARE_REGISTRY_RESOURCEID(IDR_DOCUMENTPOSITION)

BEGIN_COM_MAP(CDocumentPosition)
    COM_INTERFACE_ENTRY(IDebugDocumentPosition2)
END_COM_MAP()

DECLARE_PROTECT_FINAL_CONSTRUCT()

    HRESULT FinalConstruct();
    void FinalRelease();

    void Initialize( LPCOLESTR lpszDocName, TEXT_POSITION& posBegin, TEXT_POSITION& posEnd );

    STDMETHOD(GetFileName)( BSTR *pbstrFileName );
    STDMETHOD(GetDocument)( IDebugDocument2 **ppDoc );
    STDMETHOD(IsPositionInDocument)( IDebugDocument2 *pDoc );
    STDMETHOD(GetRange)( TEXT_POSITION *pBegPosition, TEXT_POSITION *pEndPosition );

private:
    CComBSTR        m_bsDocName;
    TEXT_POSITION   m_posBegin;
    TEXT_POSITION   m_posEnd;

};

/*
//////////////////////////////////////////////////////////////////////////
// CBreakpointResolution
class ATL_NO_VTABLE CBreakpointResolution : 
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CBreakpointResolution, &CLSID_BreakpointResolution>,
    public IDebugBreakpointResolution2 
{
public:
    CBreakpointResolution();
    virtual ~CBreakpointResolution();

DECLARE_REGISTRY_RESOURCEID(IDR_BREAKPOINTRESOLUTION)

BEGIN_COM_MAP(CBreakpointResolution)
    COM_INTERFACE_ENTRY(IDebugBreakpointResolution2)
END_COM_MAP()

DECLARE_PROTECT_FINAL_CONSTRUCT()

    HRESULT FinalConstruct();
    void FinalRelease();

    void Initialize( IDebugCodeContext2 *pContext );

public:
    //////////////////////////////////////////////////////////// 
    // IDebugBreakpointResolution2 

    // BPT_NONE, BPT_CODE, BPT_DATA, BPT_SPECIAL
    STDMETHOD(GetBreakpointType)( BP_TYPE* pBPType );

    // dwFields: BPRESI_BPRESLOCATION, BPRESI_PROGRAM, BPRESI_THREAD, BPRESI_ALLFIELDS
    STDMETHOD(GetResolutionInfo)( BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO* pBPResolutionInfo );

private:
    CBPResolutionInfo   m_bpResolutionInfo;

};

OBJECT_ENTRY_AUTO(__uuidof(BreakpointResolution), CBreakpointResolution)
*/